package com.example.support.spring;

import java.util.Arrays;

import org.springframework.core.env.Environment;

@org.springframework.stereotype.Component
public class SpringEnvHolder implements org.springframework.context.EnvironmentAware {

	private static Environment environment;

	@Override
	public void setEnvironment(Environment environment) {
		SpringEnvHolder.environment = environment;
	}

	public static Environment getEnv() {
		return SpringEnvHolder.environment;
	}

	public static boolean isDevEnv() {
		return Arrays.asList(SpringEnvHolder.environment.getActiveProfiles()).contains("dev");
	}

	public static boolean isPrdEnv() {
		return Arrays.asList(SpringEnvHolder.environment.getActiveProfiles()).contains("prd");
	}

}
